<template>
  <div>
    <div ref="chart" style="width: 1000px; height: 600px;"></div>
  </div>
</template>

<script>
import * as echarts from 'echarts';

export default {
  mounted() {
    this.initChart();
  },
  methods: {
    initChart() {
      const chartDom = this.$refs.chart;
      const myChart = echarts.init(chartDom);

      // 假设data是你的折线图数据
      const data = [
        { time: '2023-01', value: 100 },
        { time: '2023-02', value: 150 },
        { time: '2023-03', value: 200 },
        // 其他数据...
      ];

      const xAxisData = data.map(item => item.time);
      const yAxisData = data.map(item => item.value);

      const option = {
        xAxis: {
          type: 'category',
          data: xAxisData
        },
        yAxis: {
          type: 'value'
        },
        series: [{
          data: yAxisData,
          type: 'line'
        }]
      };

      myChart.setOption(option);
    }
  }
}
</script>

<style>
/* 可以添加一些样式来调整图表的显示 */
</style>